package com.changgou.listener;

import com.alibaba.otter.canal.protocol.CanalEntry;
import com.xpand.starter.canal.annotation.CanalEventListener;
import com.xpand.starter.canal.annotation.ListenPoint;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;

/**
 * @Project: com.changgou.listener
 * @Author: ShaoDi Wang
 * @Date: Created in 2019-08-06 20:59
 * @Description:
 * @Version: 1.0
 */
@CanalEventListener
public class PrefListener {

    @Autowired
    private RabbitTemplate rabbitTemplate;

    /**
     * tb_preferential表更新
     * @param eventType
     * @param rowData
     */
    @ListenPoint(schema = "changgou_order", table = {"tb_preferential"})
    public void spuUp(CanalEntry.EventType eventType, CanalEntry.RowData rowData) {
        System.err.println("tb_preferential...update");
        rabbitTemplate.convertAndSend( "","tb_preferential_update","-" );
    }
}
